package file;

import java.io.File;
import java.io.IOException;

public class Test1 {
    public static void main(String[] args) throws IOException {
        for (int i = 1;i<4;i++){
            File file = new File("./test"+i+".txt");
            if (!file.exists()){
                file.createNewFile();
                System.out.println("已创建第"+i+"个文件");
            }
        }
        for (int i=1;i<4;i++){
            File f = new File("./test"+i+".txt");
            if (f.exists()){
                f.delete();
                System.out.println("删除第"+i+"个文件");
            }else {
                System.out.println("该文件不存在");
            }
        }
    }
}
